//
//  WYCAccount.m
//  初试
//
//  Created by 中企互联 on 2017/10/19.
//  Copyright © 2017年 李胜军. All rights reserved.
//

#import "WYCAccount.h"

@implementation WYCAccount
- (instancetype)initWithDic:(NSDictionary *)dic {
    
    self = [super init];
    if (self) {
        
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
    //    if ([key isEqualToString:@"Phone"]) {
    //
    //        self.Phone = value[@"Phone"];
    //    }
}


//从文件解析对象的时候调用
-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        
        
        
        //2.保存头像
        self.avatarUrl = [aDecoder decodeObjectForKey:@"avatarUrl"];
        
        //3.姓名
        self.userName = [aDecoder decodeObjectForKey:@"userName"];
        
        
        //4.创建时间
        self.createTime = [aDecoder decodeObjectForKey:@"createTime"];
        
        
        //5.保存id
        self.uid = [aDecoder decodeObjectForKey:@"uid"];
        
        //5.保存id
        self.height = [aDecoder decodeObjectForKey:@"height"];
        
        //5.生日
        self.birthday = [aDecoder decodeObjectForKey:@"birthday"];
        
        
        self.gender = [aDecoder decodeObjectForKey:@"gender"];
        
        
        self.phoneNumber = [aDecoder decodeObjectForKey:@"phoneNumber"];
        
        
        self.belongBusid = [aDecoder decodeObjectForKey:@"belongBusid"];
        
        
        self.belongDepid = [aDecoder decodeObjectForKey:@"belongDepid"];
        
        
        self.belongRolid = [aDecoder decodeObjectForKey:@"belongRolid"];
        
        self.roleName = [aDecoder decodeObjectForKey:@"roleName"];
        
         self.country = [aDecoder decodeObjectForKey:@"country"];
        
        self.province = [aDecoder decodeObjectForKey:@"province"];
    }
    return self;
    
}

//将对象写入文件的时候调用
-(void)encodeWithCoder:(NSCoder *)aCoder
{
    //2.保存用户名
    
    [aCoder encodeObject:self.userName forKey:@"userName"];
    
    
    
    //3.保存性别
    
    [aCoder encodeObject:self.gender forKey:@"gender"];
    
    //4.保存用户id
    
    [aCoder encodeObject:self.uid forKey:@"uid"];
    
    
    //4.生日
    
    [aCoder encodeObject:self.birthday forKey:@"birthday"];
    
    
    [aCoder encodeObject:self.phoneNumber forKey:@"phoneNumber"];
    
    
    
    [aCoder encodeObject:self.createTime forKey:@"createTime"];
    
    
    [aCoder encodeObject:self.belongBusid forKey:@"belongBusid"];
    
    [aCoder encodeObject:self.belongDepid forKey:@"belongDepid"];
    
    [aCoder encodeObject:self.belongRolid forKey:@"belongRolid"];
    
    
    [aCoder encodeObject:self.avatarUrl forKey:@"avatarUrl"];
    
    
    [aCoder encodeObject:self.roleName forKey:@"roleName"];
    
    
    [aCoder encodeObject:self.height forKey:@"height"];
    
    
     [aCoder encodeObject:self.country forKey:@"country"];
    
    [aCoder encodeObject:self.country forKey:@"province"];
}
@end
